package cn.b.sky.mes.pp.utils;

/**
 * @Author: lidapeng
 * @Description:
 * @Date Created in 2019-10-14 20:20
 * @Modified By: lidapeng
 * Copyright(c) dbappsecurity.com.cn
 */
public class NumberUtils {

    /**
     * 去掉多余的.与0 如40.0转换后为40，40.010转换后为40.01
     * @param s
     * @return
     */
    public static String subZeroAndDot(String s){
        if(s.indexOf(".") > 0){
            s = s.replaceAll("0+?$", "");//去掉多余的0
            s = s.replaceAll("[.]$", "");//如最后一位是.则去掉
        }
        return s;
    }
}
